/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.agenda.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Ronildo
 */
@Entity
@Table(name = "AM_TB_SITU_AGEN_MEDI")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AmTbSituAgenMedi.findAll", query = "SELECT a FROM AmTbSituAgenMedi a"),
    @NamedQuery(name = "AmTbSituAgenMedi.findByCdSituAgenMedi", query = "SELECT a FROM AmTbSituAgenMedi a WHERE a.cdSituAgenMedi = :cdSituAgenMedi"),
    @NamedQuery(name = "AmTbSituAgenMedi.findByNmSituAgenMedi", query = "SELECT a FROM AmTbSituAgenMedi a WHERE a.nmSituAgenMedi = :nmSituAgenMedi")})
public class AmTbSituAgenMedi implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @Basic(optional = false)
    @Column(name = "CD_SITU_AGEN_MEDI")
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "seq_AM_TB_SITU_AGEN_MEDI")
    @SequenceGenerator(name="seq_AM_TB_SITU_AGEN_MEDI", sequenceName = "seq_AM_TB_SITU_AGEN_MEDI")
    private Short cdSituAgenMedi;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "NM_SITU_AGEN_MEDI")
    private String nmSituAgenMedi;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cdSituAgenMedi")
    private Collection<AmTbAgenMedi> amTbAgenMediCollection;

    public AmTbSituAgenMedi() {
    }

    public AmTbSituAgenMedi(Short cdSituAgenMedi) {
        this.cdSituAgenMedi = cdSituAgenMedi;
    }

    public AmTbSituAgenMedi(Short cdSituAgenMedi, String nmSituAgenMedi) {
        this.cdSituAgenMedi = cdSituAgenMedi;
        this.nmSituAgenMedi = nmSituAgenMedi;
    }

    public Short getCdSituAgenMedi() {
        return cdSituAgenMedi;
    }

    public void setCdSituAgenMedi(Short cdSituAgenMedi) {
        this.cdSituAgenMedi = cdSituAgenMedi;
    }

    public String getNmSituAgenMedi() {
        return nmSituAgenMedi;
    }

    public void setNmSituAgenMedi(String nmSituAgenMedi) {
        this.nmSituAgenMedi = nmSituAgenMedi;
    }

    @XmlTransient
    public Collection<AmTbAgenMedi> getAmTbAgenMediCollection() {
        return amTbAgenMediCollection;
    }

    public void setAmTbAgenMediCollection(Collection<AmTbAgenMedi> amTbAgenMediCollection) {
        this.amTbAgenMediCollection = amTbAgenMediCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cdSituAgenMedi != null ? cdSituAgenMedi.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AmTbSituAgenMedi)) {
            return false;
        }
        AmTbSituAgenMedi other = (AmTbSituAgenMedi) object;
        if ((this.cdSituAgenMedi == null && other.cdSituAgenMedi != null) || (this.cdSituAgenMedi != null && !this.cdSituAgenMedi.equals(other.cdSituAgenMedi))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.agenda.model.entity.AmTbSituAgenMedi[ cdSituAgenMedi=" + cdSituAgenMedi + " ]";
    }
    
}
